/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.


See LICENSE and AUTHORS for more information.
*/

#ifndef CHATWIDGET_H
#define CHATWIDGET_H

#include "ui_chatwidget.h"
#include "inputedit.h"
#include <QDateTime>

class QTimer;

/**
* @class chatWidget
* @brief the 1-to-1 conversation window. dockable
*
* This is the default discussion window created whenever a message is received
* that does not belong to an existing discussion or when the client initiates
* a new discussion, e.g. by doubleClicking a buddy in the roaster.
*
*/
class chatWidget : public QDockWidget
{
    Q_OBJECT
public:
    chatWidget(QDockWidget *parent);
    chatWidget(int,QString,QString);
    void msgRecv(QString senderJID,QString msg,QDateTime date);
    void stateChanged(QString state);

public slots:
    void updateBuddy(QString,QString,QModelIndex);
private slots:
    void prepareMsg(void);
    void inputChanged();
    void checkTimer();
signals:
    void msgSend(int accID, QString receiverJID,QString msg);
    void stateChanged(int accID, QString receiverJID, QString state);
private:
    Ui_chatWidget *form;
    QString buddyName;
    QString jid;
    QModelIndex index;
    int accID;
    InputEdit *input;
    bool isTyping;
    bool pausedEmitted;
    bool justCleared;
    QTimer *stateTimer;

};

#endif // CHATWIDGET_Hi
